import axios from '../utils/http'

const MenuStore = {
    namespaced:true,
    state:()=>({
        MenuList:[]
    }),
    mutations:{
       MenuMutations(state,list){
          state.MenuList=list
       }
    },
    actions:{
     MenuActions(context){
        axios.get('/api/menulist?istree=1').then((res)=>{
            if(res.code==403){
                localStorage.removeItem('loginture')
                window.location.href('/login')
            }
            if(res.code==200){
                console.log(res);
                context.commit('MenuMutations',res.list)
            }
            
        })
     }
    }
}

export default MenuStore